home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD World 1998 January
/
CD World - Ocak 1998.iso
/
misc
/
dbase55
/
disk7
/
samples1.pak
/
CUSTORD.WFM
< prev
next >
Wrap
Text File
|
1995-07-18
|
49KB
|
1,667 lines
**********************************************************************************
* PROGRAM: Custord.wfm
*
* WRITTEN BY: Borland Samples Group
*
* DATE: 1/95
*
* UPDATED: 6/95
*
* REVISION: $Revision: 1.23 $
*
* VERSION: Visual dBASE
*
* DESCRIPTION: This program displays information about the customers, orders
* and order lineitems of the Dive Shop company.
*
* PARAMETERS: None
*
* CALLS: Customer.mnu (Customer page Menu file)
* Orders.mnu (Orders page Menu file)
* Lineitem.mnu (Lineitems page Menu file)
* Buttons.cc (Custom Controls file)
* Custord.qbe (View of tables)
*
* USAGE: DO Custord.wfm && Note that you can also DO Orders.wfm
*
*******************************************************************************
#include <Messdlg.h>
#define MAX_VIEWS 3
#define CUSTOMER_VIEW 1
#define ORDERS_VIEW 2
#define LINEITEMS_VIEW 3
#define PAGE_OF_RECORDS 5
shell(.F.,.T.)
create session
set talk off
set ldCheck off && To avoid language driver conflicts
** END HEADER -- do not remove this line*
* Generated on 07/11/95
*
parameter bModal
local f
f = new CUSTORDFORM()
if (bModal)
f.mdi = .F. && ensure not MDI
f.ReadModal()
else
f.Open()
endif
CLASS CUSTORDFORM OF FORM
Set Procedure To &_dbwinhome.samples\BUTTONS.CC additive
this.Width = 80
this.MenuFile = "CUSTOMER.MNU"
this.View = "CUSTORD.QBE"
this.OnClose = CLASS::FORM_ONCLOSE
this.EscExit = .F.
this.Top = 0
this.StatusMessage = "Right click for an edit popup menu."
this.MousePointer = 1
this.Left = 0
this.Text = "Customer -- View Mode"
this.Height = 19.2344
this.CanNavigate = CLASS::FORM_CANNAVIGATE
this.Maximize = .F.
this.Minimize = .F.
this.Icon = "File CUSTORD.ICO"
this.PageNo = 1
DEFINE RECTANGLE ALLRECT OF THIS;
PROPERTY;
Width 79.166,;
Top 1.5977,;
Left 0.5,;
ColorNormal "R/BtnFace",;
Text "Customer: ",;
Height 13.8135,;
PageNo 0
DEFINE TEXT NAMETEXT OF THIS;
PROPERTY;
Width 10.833,;
Top 2.293,;
Left 1,;
ColorNormal "B/BtnFace",;
Text "N&ame:",;
Height 1.001,;
Alignment 5
DEFINE ENTRYFIELD NAMEENTRY OF THIS;
PROPERTY;
Width 54,;
Top 2.293,;
Left 12.5,;
ColorNormal "W+/BtnFace",;
Height 1.001,;
Enabled .F.,;
DataLink "CUSTOMER->NAME",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT CUSTNOTEXT OF THIS;
PROPERTY;
Width 11.502,;
Top 3.7051,;
Left 67.3311,;
ColorNormal "B/BtnFace",;
Text "Customer #:",;
Height 1,;
Alignment 3
DEFINE ENTRYFIELD CUSTNOENTRY OF THIS;
PROPERTY;
Width 11.002,;
Top 4.8809,;
Left 67.3311,;
ColorNormal "W+/BtnFace",;
Height 1.001,;
Enabled .F.,;
DataLink "CUSTOMER->CUSTOMER_N",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT STREETTEXT OF THIS;
PROPERTY;
Width 10.833,;
Top 4.2979,;
Left 1,;
ColorNormal "B/BtnFace",;
Text "&Street:",;
Height 0.9961,;
Alignment 5
DEFINE ENTRYFIELD STREETENTRY OF THIS;
PROPERTY;
Width 54,;
Top 4.2979,;
Left 12.5,;
ColorNormal "N/BtnFace",;
Height 0.9961,;
Enabled .F.,;
DataLink "CUSTOMER->STREET",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT CITYTEXT OF THIS;
PROPERTY;
Width 10.833,;
Top 5.3975,;
Left 1,;
ColorNormal "B/BtnFace",;
Text "Cit&y:",;
Height 1.0137,;
Alignment 5
DEFINE ENTRYFIELD CITYENTRY OF THIS;
PROPERTY;
Width 22.333,;
Top 5.3975,;
Left 12.5,;
ColorNormal "N/BtnFace",;
Height 1.0137,;
Enabled .F.,;
DataLink "CUSTOMER->CITY",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT STATETEXT OF THIS;
PROPERTY;
Width 16.166,;
Top 5.3975,;
Left 35.5,;
ColorNormal "B/BtnFace",;
Text "State/Pro&vince:",;
Height 1.0137,;
Alignment 5
DEFINE ENTRYFIELD STATEENTRY OF THIS;
PROPERTY;
Width 14.1689,;
Top 5.3975,;
Left 52.3311,;
ColorNormal "N/BtnFace",;
Height 1.0137,;
Enabled .F.,;
DataLink "CUSTOMER->STATE_PROV",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT ZIPTEXT OF THIS;
PROPERTY;
Width 10.833,;
Top 6.5,;
Left 1,;
ColorNormal "B/BtnFace",;
Text "&Zip Code:",;
Height 1.0293,;
Alignment 5
DEFINE ENTRYFIELD ZIPENTRY OF THIS;
PROPERTY;
Width 22.333,;
Top 6.5,;
Left 12.5,;
ColorNormal "N/BtnFace",;
Height 1.0293,;
Enabled .F.,;
DataLink "CUSTOMER->ZIP_POSTAL",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT COUNTRYTEXT OF THIS;
PROPERTY;
Width 14.835,;
Top 6.5,;
Left 36.8311,;
ColorNormal "B/BtnFace",;
Text "Count&ry:",;
Height 1.0293,;
Alignment 5
DEFINE ENTRYFIELD COUNTRYENTRY OF THIS;
PROPERTY;
Width 14.1689,;
Top 6.5,;
Left 52.3311,;
ColorNormal "N/BtnFace",;
Height 1.0293,;
Enabled .F.,;
DataLink "CUSTOMER->COUNTRY",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT PHONETEXT OF THIS;
PROPERTY;
Width 10.833,;
Top 7.6475,;
Left 1,;
ColorNormal "B/BtnFace",;
Text "P&hone:",;
Height 0.998,;
Alignment 5
DEFINE ENTRYFIELD PHONEENTRY OF THIS;
PROPERTY;
Width 22.333,;
Top 7.6475,;
Left 12.5,;
ColorNormal "N/BtnFace",;
Height 0.998,;
Enabled .F.,;
DataLink "CUSTOMER->PHONE",;
ColorHighLight "B+/W*",;
OnChange CLASS::CHANGESMADE
DEFINE TEXT SIGNATURETEXT OF THIS;
PROPERTY;
Width 20.333,;
Top 10.0586,;
Left 52.5,;
ColorNormal "B/BtnFace",;
Text "Signature:",;
Height 1,;
Alignment 3
DEFINE IMAGE SIGNATUREIMAGE OF THIS;
PROPERTY;
Width 26,;
Top 11.1758,;
Left 52.5,;
Height 2.7061,;
DataSource "BINARY CUSTOMER->SIGNATURE"
DEFINE TEXT NOTESTEXT OF THIS;
PROPERTY;
Width 10.833,;
Top 10.0586,;
Left 1,;
ColorNormal "B/BtnFace",;
Text "No&tes:",;
Height 1,;
Alignment 5
DEFINE EDITOR NOTESEDITOR OF THIS;
PROPERTY;
OnGotFocus {;if this.Modify;this.colorNormal = "B+/W*";endif},;
Width 37.166,;
OnLostFocus {;if this.Modify;this.colorNormal = "N/BtnFace";endif},;
Top 10.293,;
Left 12.5,;
CUATab .T.,;
ColorNormal "N/BtnFace",;
Height 4.2354,;
Modify .F.,;
DataLink "CUSTOMER->NOTES",;
OnChange CLASS::CHANGESMADE
DEFINE IMAGE LOGOIMAGE OF THIS;
PROPERTY;
Width 14.832,;
Top 15.5,;
Left 65.668,;
Height 2.8516,;
DataSource "FILENAME DIVESHOP.BMP",;
PageNo 0,;
Alignment 1
DEFINE RECTANGLE PAYMENTRECT OF THIS;
PROPERTY;
Width 35,;
Top 5.5879,;
Left 1.5,;
Text "Totals",;
Height 6.0586,;
PageNo 2
DEFINE RECTANGLE SHIPRECT OF THIS;
PROPERTY;
Width 77,;
Top 11.8223,;
Left 1.5,;
Text "Ship Info",;
Height 3.1768,;
PageNo 2
DEFINE TEXT ORDERNOTEXT OF THIS;
PROPERTY;
Width 10,;
Top 2.5,;
Left 3,;
ColorNormal "B/BtnFace",;
Text "Order No:",;
Height 1.2637,;
PageNo 2,;
Alignment 5
DEFINE ENTRYFIELD ORDERNOENTRY OF THIS;
PROPERTY;
Width 6.833,;
Top 2.5,;
Left 13.5,;
ColorNormal "W+/BtnFace",;
Height 1.0293,;
Enabled .F.,;
DataLink "ORDERS->ORDER_NO",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE TEXT CUSTOMERNOTEXT OF THIS;
PROPERTY;
Width 13.166,;
Top 2.5,;
Left 28.5,;
ColorNormal "B/BtnFace",;
Text "Customer No:",;
Height 1.2637,;
PageNo 2,;
Alignment 5
DEFINE ENTRYFIELD ORDCUSTNOENTRY OF THIS;
PROPERTY;
Width 6,;
Top 2.5,;
Left 42.166,;
ColorNormal "N/BtnFace",;
Height 1.0293,;
Enabled .F.,;
DataLink "ORDERS->CUSTOMER_N",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE TEXT SALEDATETEXT OF THIS;
PROPERTY;
Width 10.002,;
Top 2.5,;
Left 50.3311,;
ColorNormal "B/BtnFace",;
Text "&Sale Date:",;
Height 1.2637,;
PageNo 2,;
Alignment 5
DEFINE SPINBOX SALEDATESPIN OF THIS;
PROPERTY;
Rangemax {09/05/95},;
Width 17.333,;
Rangemin {05/28/95},;
Top 2.5,;
Left 61,;
ColorNormal "N/BtnFace",;
Height 1.0293,;
Enabled .F.,;
DataLink "ORDERS->SALE_DATE",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE BROWSE LINEITEMSBROWSE OF THIS;
PROPERTY;
Width 71.333,;
Fields "LINEITEM->STOCK_NO\13,LINEITEM->QTY\14,LINEITEM->SELL_PRICE\16,TOTAL = LINEITEM->SELL_PRICE*LINEITEM->QTY\16",;
Top 2.4688,;
Left 5,;
CUATab .T.,;
ColorNormal "B/BtnFace",;
Toggle .F.,;
Height 12.001,;
Modify .F.,;
ShowRecNo .F.,;
Alias "Lineitem",;
OnChange CLASS::LINEITEMBROWSECHANGESMADE,;
ShowDeleted .F.,;
Delete .F.,;
Append .F.,;
PageNo 3
DEFINE TEXT TOTINVTEXT OF THIS;
PROPERTY;
Width 13.6689,;
Top 6.6465,;
Left 3.6641,;
ColorNormal "B/BtnFace",;
Text "Total Invoice:",;
Height 1.0586,;
PageNo 2,;
Alignment 8
DEFINE ENTRYFIELD TOTINVENTRY OF THIS;
PROPERTY;
Width 17,;
Top 6.6465,;
Left 18,;
ColorNormal "N/BtnFace",;
Function "J",;
Height 1,;
Enabled .F.,;
DataLink "ORDERS->TOTAL",;
Picture "9,999,999.99",;
PageNo 2
DEFINE TEXT TOTPAIDTEXT OF THIS;
PROPERTY;
Width 13.1689,;
Top 8.1172,;
Left 3.6641,;
ColorNormal "B/BtnFace",;
Text "A&mount Paid:",;
Height 1,;
PageNo 2,;
Alignment 8
DEFINE ENTRYFIELD AMTPAIDENTRY OF THIS;
PROPERTY;
Width 17,;
Top 8.1172,;
Left 18,;
ColorNormal "N/BtnFace",;
Function "J",;
Height 1,;
Enabled .F.,;
DataLink "ORDERS->AMT_PAID",;
OnChange CLASS::AMTPAIDONCHANGE,;
Picture "9,999,999.99",;
PageNo 2
DEFINE TEXT BALDUETEXT OF THIS;
PROPERTY;
Width 13.1689,;
Top 9.6465,;
Left 3.6641,;
ColorNormal "B/BtnFace",;
Text "Balance Due:",;
Height 1,;
PageNo 2,;
Alignment 8
DEFINE ENTRYFIELD BALDUEENTRY OF THIS;
PROPERTY;
Width 17,;
Top 9.6465,;
Left 18,;
ColorNormal "N/BtnFace",;
Function "J",;
Height 1,;
Enabled .F.,;
Value 0,;
Picture "9,999,999.99",;
PageNo 2
DEFINE RECTANGLE TERMSRECT OF THIS;
PROPERTY;
Width 16.1357,;
Top 5.5879,;
Left 40.1973,;
Text "&Terms",;
Height 6.0586,;
PageNo 2
DEFINE RADIOBUTTON TERMSFOB OF THIS;
PROPERTY;
Width 12.833,;
Group .T.,;
Top 6.4092,;
Left 41,;
ColorNormal "N/BtnFace",;
Text "FOB",;
Height 0.7656,;
Enabled .F.,;
DataLink "ORDERS->TERMS",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON TERMSNET30 OF THIS;
PROPERTY;
Width 12.833,;
Group .F.,;
Top 7.3975,;
Left 41,;
ColorNormal "N/BtnFace",;
Text "Net 30",;
Height 0.7773,;
Enabled .F.,;
DataLink "ORDERS->TERMS",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RECTANGLE PAYMETHODRECT OF THIS;
PROPERTY;
Width 18.5,;
Top 5.5879,;
Left 60,;
Text "Pa&yment Method",;
Height 6.0586,;
PageNo 2
DEFINE RADIOBUTTON PAYCHECK OF THIS;
PROPERTY;
Width 12,;
Group .T.,;
Top 6.4102,;
Left 61,;
ColorNormal "N/BtnFace",;
Text "Check",;
Height 0.7646,;
Enabled .F.,;
DataLink "ORDERS->PAY_METHOD",;
OnChange CLASS::CHANGESMADE,;
PageNo 2,;
ID 1
DEFINE RADIOBUTTON PAYCREDIT OF THIS;
PROPERTY;
Width 12,;
Group .F.,;
Top 7.3975,;
Left 61,;
ColorNormal "N/BtnFace",;
Text "Credit",;
Height 0.7773,;
Enabled .F.,;
DataLink "ORDERS->PAY_METHOD",;
OnChange CLASS::CHANGESMADE,;
PageNo 2,;
ID 1
DEFINE RADIOBUTTON PAYMC OF THIS;
PROPERTY;
Width 12,;
Group .F.,;
Top 8.3975,;
Left 61,;
ColorNormal "N/BtnFace",;
Text "MC",;
Height 0.7773,;
Enabled .F.,;
DataLink "ORDERS->PAY_METHOD",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON PAYCASH OF THIS;
PROPERTY;
Width 12,;
Group .F.,;
Top 9.293,;
Left 61,;
ColorNormal "N/BtnFace",;
Text "Cash",;
Height 0.7646,;
Enabled .F.,;
DataLink "ORDERS->PAY_METHOD",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON PAYVISA OF THIS;
PROPERTY;
Width 12,;
Group .F.,;
Top 10.3516,;
Left 61,;
ColorNormal "N/BtnFace",;
Text "Visa",;
Height 0.7646,;
Enabled .F.,;
DataLink "ORDERS->PAY_METHOD",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE TEXT SHIPDATETEXT OF THIS;
PROPERTY;
Width 12.835,;
Top 12.7637,;
Left 1.8311,;
ColorNormal "B/BtnFace",;
Text "S&hip Date:",;
Height 0.7061,;
PageNo 2,;
Alignment 5
DEFINE SPINBOX SHIPDATESPIN OF THIS;
PROPERTY;
Rangemax {09/12/95},;
Width 17.333,;
Rangemin {06/04/95},;
Top 12.4102,;
Left 18,;
ColorNormal "N/BtnFace",;
Height 1.001,;
Enabled .F.,;
DataLink "ORDERS->SHIP_DATE",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE TEXT SHIPVIATEXT OF THIS;
PROPERTY;
Width 11.335,;
Top 14,;
Left 3.3311,;
ColorNormal "B/BtnFace",;
Text "Ship &Via:",;
Height 0.8223,;
PageNo 2,;
Alignment 5
DEFINE RADIOBUTTON SHIPDHL OF THIS;
PROPERTY;
Width 10.1689,;
Group .T.,;
Top 14,;
Left 17.8311,;
ColorNormal "N/BtnFace",;
Text "DHL",;
Height 0.8223,;
Enabled .F.,;
DataLink "ORDERS->SHIP_VIA",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON SHIPEMERY OF THIS;
PROPERTY;
Width 10.1689,;
Group .F.,;
Top 14,;
Left 28.8311,;
ColorNormal "N/BtnFace",;
Text "Emery",;
Height 0.8223,;
Enabled .F.,;
DataLink "ORDERS->SHIP_VIA",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON SHIPFEDEX OF THIS;
PROPERTY;
Width 10.1689,;
Group .F.,;
Top 14,;
Left 41.1641,;
ColorNormal "N/BtnFace",;
Text "FedEx",;
Height 0.8223,;
Enabled .F.,;
DataLink "ORDERS->SHIP_VIA",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON SHIPUPS OF THIS;
PROPERTY;
Width 10.1689,;
Group .F.,;
Top 14,;
Left 54.1641,;
ColorNormal "N/BtnFace",;
Text "UPS",;
Height 0.8223,;
Enabled .F.,;
DataLink "ORDERS->SHIP_VIA",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE RADIOBUTTON SHIPUSMAIL OF THIS;
PROPERTY;
Width 9.833,;
Group .F.,;
Top 14,;
Left 65,;
ColorNormal "N/BtnFace",;
Text "US Mail",;
Height 0.8223,;
Enabled .F.,;
DataLink "ORDERS->SHIP_VIA",;
OnChange CLASS::CHANGESMADE,;
PageNo 2
DEFINE TABBOX PAGETABBOX OF THIS;
PROPERTY;
Width 80,;
Top 18.1758,;
Height 1.0586,;
ColorHighLight "BtnText/BtnFace",;
OnSelChange CLASS::PAGETABBOX_ONSELCHANGE,;
DataSource "Array {'Customers','Orders', 'Line Items'}",;
ID 167
DEFINE RECTANGLE SPEEDBARRECT OF THIS;
PROPERTY;
Width 80,;
Text "",;
Height 1.5879,;
BorderStyle 1,;
PageNo 0
DEFINE BROWSE CUSTOMERBROWSE OF THIS;
PROPERTY;
Width 77.0684,;
Top 2.5977,;
Left 1.5977,;
CUATab .T.,;
Toggle .F.,;
Height 11.9893,;
Alias "Customer",;
PageNo 10
DEFINE BROWSE ORDERSBROWSE OF THIS;
PROPERTY;
Width 76.5684,;
Top 2.5977,;
Left 1.5977,;
CUATab .T.,;
Height 11.9893,;
Alias "Orders",;
PageNo 20
DEFINE PUSHBUTTON BROWSESPEEDBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #610",;
Group .T.,;
Top 0.0977,;
Left 22,;
Text "",;
Height 1.4307,;
OnClick CLASS::BROWSESPEEDBUTTON_ONCLICK,;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON SEARCHSPEEDBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #858",;
Group .T.,;
Top 0.0977,;
Left 26,;
Text "",;
Height 1.4307,;
OnClick CLASS::SEARCHSPEEDBUTTON_ONCLICK,;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON VCRFIRSTBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #851",;
Group .T.,;
Top 0.0889,;
Left 40,;
Text "",;
Height 1.4395,;
OnClick CLASS::VCRFIRSTBUTTON_ONCLICK,;
SpeedTip "First Record",;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON VCRPREVPAGEBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #852",;
Group .T.,;
Top 0.0889,;
Left 44,;
Text "",;
Height 1.4395,;
OnClick CLASS::VCRPREVPAGEBUTTON_ONCLICK,;
SpeedTip "Previous Page",;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON VCRPREVBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #853",;
Group .T.,;
Top 0.0889,;
Left 48,;
Text "",;
Height 1.4395,;
OnClick CLASS::VCRPREVBUTTON_ONCLICK,;
SpeedTip "Previous Record",;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON VCRNEXTBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #854",;
Group .T.,;
Top 0.0889,;
Left 52,;
Text "",;
Height 1.4395,;
OnClick CLASS::VCRNEXTBUTTON_ONCLICK,;
SpeedTip "Next Record",;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON VCRNEXTPAGEBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #855",;
Group .T.,;
Top 0.0889,;
Left 56,;
Text "",;
Height 1.4395,;
OnClick CLASS::VCRNEXTPAGEBUTTON_ONCLICK,;
SpeedTip "Next Page",;
SpeedBar .T.,;
PageNo 0
DEFINE PUSHBUTTON VCRLASTBUTTON OF THIS;
PROPERTY;
Width 4,;
UpBitmap "RESOURCE #856",;
Group .T.,;
Top 0.0889,;
Left 60,;
Text "",;
Height 1.4395,;
OnClick CLASS::VCRLASTBUTTON_ONCLICK,;
SpeedTip "Bottom Record",;
SpeedBar .T.,;
PageNo 0
DEFINE SAMPLEINFOBUTTON CUSTORDINFOBUTTON OF THIS;
PROPERTY;
Width 4,;
Group .T.,;
Top 0.0977,;
Left 75.5,;
Height 1.4307
procedure Open
****************************************************************************
private custNoField, orderNoField, stockNoField, saveAlias, tempBubble
set skip to && So can skip in each workarea
set exact off && Customer.qbe has set exact on
set procedure to program(1) additive && For BubbleClass
set procedure to &_dbwinhome.samples\SampProc.prg additive
set procedure to Custord.pop additive && Popup file
form.popupMenu = new CustOrdPopup(form,"editPopup")
*** Bubbles
tempBubble = new BubbleClass(form, "bubble1", 16.4473, 2, .4902, 9)
tempBubble = new BubbleClass(form, "bubble2", 16.3975, 14, .6025, 10)
tempBubble = new BubbleClass(form, "bubble3", 16.3975, 28, .665, 10)
tempBubble = new BubbleClass(form, "bubble4", 16.3477, 42, .7773, 10)
tempBubble = new BubbleClass(form, "bubble5", 16.2979, 56, .9521, 10)
*** Do calculations in other area, so form doesn't update on record moves
use CUSTOMER again in select() alias temp
select temp
custNoField = field(1) && Field customer_n
set order to &custNoField && Tag name is same as field name
go bottom
form.maxCustNo = &custNoField && Max value for the key - used for
&& creating new customers
use ORDERS again alias temp
orderNoField = field(1) && order_no field
set order to &orderNoField && order_no -- tag name is same as field
go bottom
*** !!! Should be replace with maxOrderNo
form.maxOrder = &orderNoField && max value for key field -- for creating
&& new orders
use LINEITEM again alias temp
stockNoField = field(2) && stock_no field
set order to &stockNoField && stock_no -- tag name is same as field
go bottom
form.maxStockNo = &stockNoField && max value for key field -- for creating
&& new line items
use in temp
select CUSTOMER
*** Other setup work
form.root.customer.separator3.Release() && Don't need this menu
form.root.customer.current_orders.Release()
form.customerPage = new object() &&text(form)
form.customerPage.visible = .F.
form.customerPage.pageNo = CUSTOMER_VIEW
form.customerPage.menu = form.root.customer
form.customerPage.view = CUSTOMER_VIEW
form.customerPage.inEditMode = .F.
form.customerPage.changesMade = .F.
form.ordersPage = .F.
form.lineitemsPage = .F.
form.curPage = form.customerPage && For storing page info
CLASS::SaveFirstLastRecNo() && For navigating in cur page table
form.previousRecord = .F. && Save record number when appending
&& customer, can only move forward
form.runCheckCommit = .F. && Indicates to CanNavigate that
&& a transaction check should be done
form.custOrdInfoButton.sampleName = "Custord.wfm"
form.pageTabbox.SetFocus() && Start on tabbox -- it is enabled
form::Open() && Now the form actually opens
****************************************************************************
procedure Form_OnClose
****************************************************************************
if form.curPage.inEditMode
form.ViewEdit()
endif
close procedure &_dbwinhome.samples\SampProc.prg,;
&_dbwinhome.samples\Custord.pop, program(1)
shell(.T.)
****************************************************************************
procedure Form_CanNavigate
* Procedure executed before the record pointer is moved. The main body
* of this routine will only be run if the runCheckCommit property is set
* to .T. -- this is to make sure that transactions aren't opened or
* closed when they shouldn't be (sometimes the record pointer is moved
* within this code, and not by explicit instructions from the form)
****************************************************************************
if form.runCheckCommit && If transactions need checking
form.runCheckCommit = .F. && Reset variable
CLASS::CheckCommit(form.curPage.inEditMode) && Check transactions
endif
****************************************************************************
procedure ChangesMade
* Indicate that changes have been made to the current record.
****************************************************************************
form.curPage.changesMade = .T.
****************************************************************************
procedure CheckCommit (newInEditMode)
* Complete transaction, if it has been started.
****************************************************************************
private orderText, orderField, changesMade, inEditMode
changesMade = form.curPage.changesMade
inEditMode = form.curPage.inEditMode
if changesMade .and. inEditMode
do case
case form.curPage.pageNo = CUSTOMER_VIEW
orderField = field(1)
orderText = "Customer %1"
case form.curPage.pageNo = ORDERS_VIEW
orderField = field(1)
orderText = "Order %1"
case form.curPage.pageNo = LINEITEMS_VIEW
orderField = field(2)
orderText = "Lineitem for Stock No %1"
endcase
if ConfirmationMessage("Commit changes?",;
FormatStr(orderText, &orderField)) = YES
commit()
else
rollback()
if .not. empty(form.previousRecord) .and. (form.previousRecord > 0) .and.;
(form.previousRecord < reccount())
form.canNavigate = .F.
go form.previousRecord
form.canNavigate = CLASS::Form_CanNavigate
form.previousRecord = .F.
endif
endif
if inEditMode .and. newInEditMode
begintrans()
endif
form.curPage.changesMade = .F.
endif
if inEditMode <> newInEditMode
if newInEditMode && Going to Edit mode
begintrans()
else && Going to View mode
if .not. changesMade
rollback()
endif
endif
endif
****************************************************************************
procedure ViewEdit
* Toggle between View and Edit modes.
****************************************************************************
local inEditMode, editMenu, control, editPopupMenu
editMenu = form.curPage.menu.viewEdit
editPopupMenu = form.editPopup.viewEdit
*** If ending edit mode then close transaction, otherwise open it.
if form.curPage.inEditMode && Switch to View mode
form.checkChanged(.F.)
editMenu.text = "&Edit"
editMenu.shortcut = "Ctrl-E"
editMenu.statusMessage = "Edit data."
editPopupMenu.text = "&Edit" && Change popup menu text
form.curPage.menu.delete.enabled = .F. && disabled in view mode
CLASS::CheckCommit(.F.) && Check transaction
form.curPage.inEditMode = .F. && Change inEditMode
CLASS::PrepFormForView()
else && Switch to edit mode
editMenu.text = "Vi&ew"
editMenu.shortcut = "Ctrl-E"
editMenu.statusMessage = "View data."
editPopupMenu.text = "Vi&ew" && Change popup menu text
form.curPage.menu.delete.enabled = .T. && enabled in edit mode
CLASS::CheckCommit(.T.) && Check transaction
form.curPage.inEditMode = .T. && Change inEditMode
CLASS::PrepFormForEdit()
endif
inEditMode = form.curPage.inEditMode && Faster if we don't reference a form
control = form.first && variable each time through the loop
do
if control.pageNo = form.curPage.view
do case
case control.name $ "CUSTNOENTRY,ORDERNOENTRY,ORDCUSTNOENTRY,TOTINVENTRY,BALDUEENTRY"
* these are never editable
control.enabled = .F.
case .not. control.className $ "BROWSE,EDITOR,PUSHBUTTON,IMAGE,TEXT"
control.enabled = inEditMode
case control.className = "BROWSE"
control.modify = inEditMode
control.delete = inEditMode
control.append = inEditMode
endcase
endif
control = control.before
until control.name = form.first.name
if form.curPage.pageNo = CUSTOMER_VIEW
form.nameEntry.SetFocus() && Move to the name entryfield
endif
****************************************************************************
procedure CheckChanged(callCommit)
* Check if changes have been made to the current entryfield. This procedure
* is mostly called from menu routines to make sure form.curPage.changesMade
* gets updated when a menu is selected while the changed control has focus.
****************************************************************************
private control, fieldValue, controlValue, typeText, typeValue
if form.curPage.inEditMode
control = form.activeControl
if type("control.datalink") <> "U"
fieldValue = control.datalink && name of table field
typeText = type("control.text")
typeValue = type("control.value")
do case
case typeValue = "C"
controlValue = control.value
case typeValue $ "LU" .and. typeText = "C"
controlValue = control.text
otherwise
controlValue = Null
endcase
if controlValue <> &fieldValue
form.curPage.changesMade = .T.
endif
endif
endif
if form.curPage.changesMade .and. callCommit
CLASS::CheckCommit(form.curPage.inEditMode) && Check transactions
endif
****************************************************************************
procedure LineitemBrowseOnNavigate
* Calculate total invoice and balance
****************************************************************************
if eof()
form.curPage.menu.viewEdit.enabled = .F.
else
form.curPage.menu.viewEdit.enabled = .T.
form.balDueEntry.value = total - form.AmtPaidEntry.value
show object form.balDueEntry
endif
****************************************************************************
procedure LineitemBrowseChangesMade
* Make sure totals correct when lineitem values change.
****************************************************************************
local tempTotal, saveRec
form.curPage.changesMade = .T.
go recno("LINEITEM") in lineitem && Make sure change is posted
saveRec = recno()
calculate all sum(lineitem->sell_price * lineitem->qty) to tempTotal
select orders && Must do this to register changes
replace total with tempTotal && Calculate new total
form.balDueEntry.value = orders->total - orders->amt_paid
select lineitem
go saveRec in lineitem && Go back to changed record
****************************************************************************
procedure AmtPaidOnChange
* Recalculate totals when amtPaid is changed.
****************************************************************************
form.curPage.changesMade = .T.
form.LineitemBrowseOnNavigate() && Calculate totals
****************************************************************************
procedure PageTabbox_OnSelChange
* Set up current page.
****************************************************************************
* Don't do anything if click on currently selected tab
if this.curSel <> form.curPage.pageNo
do case
case this.curSel = CUSTOMER_VIEW
CLASS::SelectCustomerPage()
case this.curSel = ORDERS_VIEW
CLASS::SelectOrdersPage()
case this.curSel = LINEITEMS_VIEW
CLASS::SelectLineitemsPage()
otherwise
&& Only 3 tabs for now
endcase
form.pageno = this.curSel && Change page after setup
CLASS::SaveFirstLastRecNo() && Save first/last recs for navigation
&& Always start in non-browse mode
form.browseSpeedButton.upBitmap = "Resource #610"
if form.curPage.inEditMode && Change text/statusMessage
CLASS::PrepFormForEdit()
else
CLASS::PrepFormForView()
endif
endif
****************************************************************************
Procedure SEARCHSPEEDBUTTON_OnClick
* Call Search.wfm
****************************************************************************
form.curPage.menu.search.OnClick()
****************************************************************************
Procedure SelectCustomerPage
* Set up Customer page.
****************************************************************************
CLASS::CheckCommit(.F.)
select CUSTOMER
form.root.Release()
form.menuFile = "Customer.mnu"
form.root.customer.separator3.Release() && Don't need this menu
form.root.customer.current_orders.Release()
form.allRect.text = "Customer:"
form.browseSpeedButton.visible = .T.
if type("form.customerPage") <> "O"
form.customerPage = new text(form)
form.customerPage.visible = .F.
form.customerPage.pageNo = CUSTOMER_VIEW
form.customerPage.view = CUSTOMER_VIEW
form.customerPage.inEditMode = .F.
form.customerPage.changesMade = .F.
endif
form.customerPage.menu = form.root.customer && Assign customer menu
form.curPage = form.customerPage
form.OnNavigate = .F.
if form.curPage.inEditMode
form.text = "Customers -- Edit Mode"
form.editPopup.viewEdit.text = "Vi&ew"
form.nameEntry.SetFocus()
else
form.text = "Customers -- View Mode"
form.editPopup.viewEdit.text = "&Edit"
endif
****************************************************************************
Procedure SelectOrdersPage
* Set up Orders page.
****************************************************************************
CLASS::CheckCommit(.F.)
select ORDERS
form.root.Release()
form.menuFile = "Orders.mnu"
form.root.order.separator3.Release() && Don't need this here
form.root.order.current_customer.Release()
form.allRect.text = "Order Info -- " + rtrim(CUSTOMER->NAME)
form.browseSpeedButton.visible = .T.
if type("form.ordersPage") <> "O"
form.ordersPage = new object()
form.ordersPage.visible = .F.
form.ordersPage.pageNo = ORDERS_VIEW
form.ordersPage.view = ORDERS_VIEW
form.ordersPage.inEditMode = .F.
form.ordersPage.changesMade = .F.
endif
form.ordersPage.menu = form.root.order
form.curPage = form.ordersPage
form.OnNavigate = CLASS::OrdersOnNavigate
form.OnNavigate()
if form.curPage.inEditMode
form.text = "Orders -- Edit Mode"
form.editPopup.viewEdit.text = "Vi&ew"
form.saleDateSpin.SetFocus()
else
form.text = "Orders -- View Mode"
form.editPopup.viewEdit.text = "&Edit"
endif
****************************************************************************
Procedure SelectLineitemsPage
* Set up lineitems page.
****************************************************************************
CLASS::CheckCommit(.F.)
select LINEITEM
form.root.Release()
form.menuFile = "Lineitem.mnu"
form.allRect.text = "Line Items -- Order #" +;
ORDERS->ORDER_NO +;
", Customer: " +;
rtrim(CUSTOMER->NAME)
form.browseSpeedButton.visible = .F. && No need to have browse view
&& for this page.
if type("form.lineitemsPage") <> "O"
form.lineitemsPage = new object()
form.lineitemsPage.visible = .F.
form.lineitemsPage.pageNo = LINEITEMS_VIEW
form.lineitemsPage.view = LINEITEMS_VIEW
form.lineitemsPage.inEditMode = .F.
form.lineitemsPage.changesMade = .F.
endif
form.lineitemsPage.menu = form.root.lineitem
form.curPage = form.lineitemsPage
form.OnNavigate = .F.
if form.curPage.inEditMode
form.text = "Lineitems -- Edit Mode"
form.editPopup.viewEdit.text = "Vi&ew"
form.lineItemsBrowse.SetFocus()
else
form.text = "Lineitems -- View Mode"
form.editPopup.viewEdit.text = "&Edit"
endif
****************************************************************************
Procedure OrdersOnNavigate
* Update controls that are not datalinked
****************************************************************************
form.balDueEntry.value = orders->total - form.AmtPaidEntry.value
****************************************************************************
Procedure BROWSESPEEDBUTTON_OnClick
* Toggle between Detail and Browse views.
****************************************************************************
if this.upBitmap = "RESOURCE #610" && If currently in detail view
this.inDetailView = .F. && Switch to browse from detail view
form.pageNo = form.pageNo * 10 && Browse view is on pageNo * 10
this.upBitmap = "Resource #613"
else
this.inDetailView = .T. && Switch to detail view from browse
form.pageNo = form.pageNo / 10 && Detail view is on pageNo / 10
this.upBitmap = "Resource #610"
endif
****************************************************************************
Procedure PrepFormForView
****************************************************************************
do case
case form.curPage.view = CUSTOMER_VIEW
form.text = "Customers -- View Mode" && change mode to View
form.notesEditor.colorNormal = "N/BtnFace"
form.notesEditor.modify = .F.
form.statusmessage = "In View Mode. " + ;
"Select Customer - Edit menu to " + ;
"edit/delete data."
case form.curPage.view = ORDERS_VIEW
form.text = "Orders -- View Mode" && change mode to View
form.statusMessage = "Select Order - Edit menu choice to " +;
"edit/delete data."
case form.curPage.view = LINEITEMS_VIEW
form.text = "Lineitems -- View Mode" && change mode to View
form.statusMessage = "Select Lineitem - Edit menu choice to " +;
"edit/delete data."
endcase
****************************************************************************
Procedure SaveFirstLastRecNo
* Save first/last recs for navigation warnings when get to these records.
****************************************************************************
local curRec
curRec = recno()
go top
form.curPage.firstRec = recno() && Store first and last records for bound checks
go bottom
form.curPage.lastRec = recno()
if .not. eof() .and. curRec > 0
go curRec
endif
****************************************************************************
Procedure PrepFormForEdit
****************************************************************************
do case
case form.curPage.view = CUSTOMER_VIEW
form.text = "Customers -- Edit Mode" && change mode to Edit
form.notesEditor.modify = .T.
form.custNoEntry.enabled = .F. && Key field is always disabled
form.nameEntry.SetFocus() && Move to the name entryfield
form.statusmessage = "In Edit Mode. " + ;
"Select Customer - View menu choice" +;
" to switch to View mode."
case form.curPage.view = ORDERS_VIEW
form.text = "Orders -- Edit Mode" && change mode to Edit
form.statusMessage = "In Edit Mode. " +;
"Select Order - View menu choice" +;
" to switch to View mode."
case form.curPage.view = LINEITEMS_VIEW
form.text = "Lineitems -- Edit Mode" && change mode to Edit
form.statusMessage = "In Edit Mode. " +;
"Select Lineitem - View menu choice" +;
" to switch to View mode."
endcase
****************************************************************************
Procedure VCRFirstButton_OnClick
****************************************************************************
if CLASS::IsTableOpen() .and. .not. CLASS::OnFirstRec()
form.runCheckCommit = .T. && Check for active transactions
go top
endif
****************************************************************************
Procedure VCRPrevPageButton_OnClick
****************************************************************************
if CLASS::IsTableOpen() .and. .not. CLASS::OnFirstRec()
form.runCheckCommit = .T. && Check for active transactions
skip -PAGE_OF_RECORDS
CLASS::CheckBOF()
endif
****************************************************************************
Procedure VCRPrevButton_OnClick
****************************************************************************
if CLASS::IsTableOpen() .and. .not. CLASS::OnFirstRec()
form.runCheckCommit = .T. && Check for active transactions
skip - 1
endif
****************************************************************************
Procedure VCRNextButton_OnClick
****************************************************************************
if CLASS::IsTableOpen() .and. .not. CLASS::OnLastRec()
form.runCheckCommit = .T. && Check for active transactions
skip
endif
****************************************************************************
Procedure VCRNextPageButton_OnClick
****************************************************************************
if CLASS::IsTableOpen() .and. .not. CLASS::OnLastRec()
form.runCheckCommit = .T. && Check for active transactions
skip PAGE_OF_RECORDS
CLASS::CheckEOF()
endif
****************************************************************************
Procedure VCRLastButton_OnClick
****************************************************************************
if CLASS::IsTableOpen() .and. .not. CLASS::OnLastRec()
form.runCheckCommit = .T. && Check for active transactions
go bottom
endif
****************************************************************************
Function IsTableOpen
* Check if a table is open in current workarea.
****************************************************************************
private tableOpen
if empty(dbf()) && if a table is not open in the current workarea
InformationMessage("There is no table open in the current workarea.",;
"Info")
tableOpen = .F.
else
tableOpen = .T.
endif
return tableOpen
****************************************************************************
Function OnFirstRec
* Check if currently located on first record in current order.
****************************************************************************
private firstRec
firstRec = .F.
if recno() = form.curPage.firstRec
go top
AlertMessage("At the first record","Alert")
firstRec = .T.
endif
return firstRec
****************************************************************************
Function OnLastRec
* Check if currently located on last record in current order.
****************************************************************************
private lastRec
lastRec = .F.
if recno() = form.curPage.lastRec
go bottom
AlertMessage("At the last record","Alert")
lastRec = .T.
endif
return lastRec
****************************************************************************
Procedure CheckEOF
****************************************************************************
if eof()
go bottom
AlertMessage("At the last record","Alert")
endif
****************************************************************************
Procedure CheckBOF
****************************************************************************
if bof()
go top
AlertMessage("At the first record","Alert")
endif
ENDCLASS
*******************************************************************************
*******************************************************************************
CLASS BubbleClass(f, name, btop, bleft, bheight, bwidth) of Shape(f, name)
* Defines Bubbles floating around bottom of form
*******************************************************************************
private highlightName
this.ColorNormal = "w+/BtnFace"
this.Left = bleft
this.Top = btop
this.Height = bheight
this.Width = bwidth
this.PageNo = 0
this.PenWidth = 1
highlightName = "Highlight" + name
define shape &highlightName of f;
PROPERTY;
Top btop + .15*bheight,;
Left bleft + bwidth/3.1,;
Height 0.1775,;
Width 2.83,;
ColorNormal "w+/BtnFace",;
PageNo 0,;
PenWidth 1
ENDCLASS